jQuery(function()
{
	  jQuery.post(
              base+"/userStatistics/userStatisticsData.do", 
              function(result){
                  var data= eval("("+result+")");
                  var userTypeData =data.userType;
                  var userStatusData =data.userStatus;
                  var userVirtualData =data.userVirtual;
                  initPieChart("userTypeChart", userTypeData);
                  initPieChart("userStatusChart", userStatusData);
                  initPieChart("userVirtualChart", userVirtualData);
              });
}		
);


function initPieChart(renderToDiv,data)
{
	   // Build the chart
    $('#'+renderToDiv).highcharts({
        chart: {
            backgroundColor:'#f3ffe3',
            plotBorderWidth: null,
            plotShadow: false
        },
        credits:{enabled:false},
        exporting:{enabled:false},
        title: {
            text: data.title
        },
        tooltip: {
            pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
                dataLabels: {
                    enabled: false
                },
                showInLegend: true
            }
        },
        series: [{
            type: 'pie',
            name: 'Browser share',
            data: data.data
        }]
    });	
}